package leader.action;

import leader.bean.Leader;
import leader.service.LeaderService;

import com.opensymphony.xwork2.ActionContext;

import teacher.bean.Teacher;
import java.text.SimpleDateFormat;
public class DirectInformationAction {
	private String name;
	private String subject;
	private String leader;
	private String email;
	private String introduction;
	private String remarks;	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public String getLeader() {
		return leader;
	}
	public void setLeader(String leader) {
		this.leader = leader;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getIntroduction() {
		return introduction;
	}
	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	public String execute(){
		Teacher lead=(Teacher) ActionContext.getContext().getSession().get("leader");
		LeaderService lea = new LeaderService();
		if(null != lea.selectLeader(lead)) {
			Leader leaderinfo = lea.selectLeader(lead);
			if(null != leaderinfo.getName()) {
				name = leaderinfo.getName();
			} else {
				name = "";
			}
			if(null != leaderinfo.getMailbox()) {
				email = leaderinfo.getMailbox();
			} else {
				email = "";
			}
			if(null != lea.selectTeacher(lead)) {
				if(null != lea.selectTeacher(lead).getName()) {
					leader = lea.selectTeacher(lead).getName();
				}
			} else {
				leader = "";
			}
			if(null != lea.selectSubject(lead)) {
				if(null != lea.selectSubject(lead).getName()) {
					subject = lea.selectSubject(lead).getName();
				}
			} else {
				subject = "";
			}
			if(null != leaderinfo.getIntroduction()) {
				introduction = leaderinfo.getIntroduction();
			} else {
				introduction = "";
			}
			if(null != leaderinfo.getRemarks()) {
				remarks = leaderinfo.getRemarks();
			} else {
				remarks = "";
			}
		}
		return "success";
	}
}
